import {createRouter,createWebHashHistory} from 'vue-router'
import {pageRoutes} from "./page/index"
import {viewRoutes} from './view/index'
import store from '../store'
//import configs from '/@/config/config'
//console.log("config:", store.state.config.config)
let layout:any = [
    ... pageRoutes,
    ... viewRoutes
]
console.log("test: ", layout)
const routes = layout
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
router.beforeEach(async (to: any, from: any, next) => {
    await store.dispatch("user/setVirtualRoles")
    await store.dispatch("routes/setRoutes")
    next()
})
router.afterEach((to: any) => {
    document.title = to.meta.title
})
export default router